import React from 'react';


class App extends React.Component {
  constructor(props) {
    super(props)
  };

  add = () => {
    this.props.increment(1)
  }
  de = () => {
    this.props.decrement(1)
  }
  asyncAdd = () => {
    this.props.asyncIncrement(1)
  }
  asyncDe = () => {
    this.props.asyncDecrement(1)
  }

  render() {
    let count = this.props.store.count;
    return (
      <div className="App">
        <p>同步</p>
        <h2>
          <button onClick={this.de}>-</button> {count} <button onClick={this.add}>+</button>
        </h2>
        <hr />
        <p>异步</p>
        <h2>
          <button onClick={this.asyncDe}>-</button> {count} <button onClick={this.asyncAdd}>+</button>
        </h2>
      </div>
    );
  }
}

export default App;

